<!--
 * @Description  : 借阅列表
 * @Author       : zhao
 * @Date         : 2022-07-11 14:05:38
 * @LastEditors  : zhao
 * @LastEditTime : 2023-01-30 16:33:24
-->

<template>
	<div class="Borrow">
		<ztable :searchType="searchType" :tableHeader="tableHeader" :title="'借阅管理'" />
	</div>
</template>

<script lang="ts">
export default {
	name: "Borrow",
};
</script>


<script setup  lang='ts'>
import { ref, onBeforeUnmount, onActivated } from 'vue';
import ztable from '/@/components/zTable/index.vue';
import BFData from '/@/views/zBorrow/BorrowForm.ts';
import { useTableInfo } from '/@/stores/ztable'

import { useUserInfo } from '/@/stores/userInfo'


const { getWorkCompany } = useUserInfo()

let searchType = ref(BFData.searchType);
const tableHeader = ref(BFData.tableHeader);
const tableData = ref(BFData.tableData);

const { zTable, zTableType, zTableFunction } = useTableInfo()

//获取借阅单位
// const WorkCompanydata = await getWorkCompany()

// searchType.map((e: any) => {
// 	if (e.prop == "ReviewState") e.option = WorkCompanydata.data
// })
let useTableInfos = useTableInfo()
useTableInfos.$reset()

useTableInfos.zTableType.border = false
useTableInfos.zTableType.menu = true
useTableInfos.zTable.routerUrl = "/Borrow/details"
useTableInfos.zTableFunction.add = false
useTableInfos.zTableFunction.modify = false
useTableInfos.zTable.mdName.name = "useBorrow"
useTableInfos.zTable.mdName.url = "CSGetBorrowingForm"
useTableInfos.zTable.menuData = [
	{ name: '待审核' },
	{ name: '已审核' },
	{ name: '已驳回' },
	{ name: '已完成' },
	{ name: '已过期' },

]

const getCompany = async () => {
	const res = await getWorkCompany()
	searchType.value[3].options = res.data
}

getCompany()


// //定时刷新页面
// let theSetInterval: any = null
// const regularlyRefreshThePage = () => {
// 	theSetInterval = setInterval(async (e) => {
// 		const activeIndex = useTableInfos.menuType.activeIndex
// 		if (activeIndex == "menu0") {
// 			useTableInfos.zTable.mdName.name = "useBorrow"
// 			useTableInfos.zTable.mdName.url = "CSGetBorrowingForm"
// 			await useTableInfos.getTableData()
// 		}
// 	}, 400000)

// }
// regularlyRefreshThePage()

// onBeforeUnmount(() => {

// 	clearInterval(theSetInterval)
// })

// onActivated(() => {
// 	useTableInfos.zTableType.border = false
// useTableInfos.zTableType.menu = true
// useTableInfos.zTable.routerUrl = "/Borrow/details"
// useTableInfos.zTableFunction.add = false
// useTableInfos.zTableFunction.modify = false

// useTableInfos.zTable.menuData = [
// 	{ name: '待审核' },
// 	{ name: '已审核' },
// 	{ name: '已驳回' },
// 	{ name: '已完成' },
// 	{ name: '已过期' },

// ]
// })
</script>
<style lang='scss' scoped>
</style>
